<?php
session_start();
require_once "common.php";
$username=$_POST[username];
$password=$_POST[password];
$login=new login($username,$password);
$res=$login->check();
if(is_array($res)){
	//echo "登录成功！";
	$_SESSION['time']=mktime();
	$_SESSION['username']=$res['username'];
	$_SESSION['password']=$res['password'];
	$certif=new certificate($res['username'],$res['password'],'');
	$_SESSION['shell']=$certif->encode();
	//echo $_SESSION['shell']."<br />";
	//$shell=$certif->encode();
	//echo $shell;
	//echo "<a href='./admin.php'>点击进入管理页面</a>";
	$redirector=new redirector('./admin.php',3,'登录成功！');
	$redirector->redirect();

}else{
	$redirector=new redirector('./login.html',3,'登录失败，请确认账号密码！');
	$redirector->redirect();
	//echo "登录失败！请重新登录";
	//echo "<a href='./login.html'>返回登录界面</a>";

}

?>